bender.loadExternalPlugin("exportpdf","/apps/plugin/"),CKEDITOR.plugins.load("exportpdf",(function(){function t(t,e,i){i=exportPdfUtils.getDefaultConfig("unit",i||{}),bender.editorBot.create({name:"editor"+Date.now(),config:i},(function(i){var r=i.editor;i.setHtmlWithSelection(t),r.once("exportPdf",(function(e){assert.areEqual(t,e.data.html)}),null,null,10),r.once("exportPdf",(function(t){t.cancel(),assert.areEqual('<div class="cke_editable cke_contents_ltr">'+e+"</div>",t.data.html)}),null,null,16),r.execCommand("exportPdf")}))}function e(t,e){return t=t.replace(/\/$/g,""),e&&0<e&&(t=t.split("/").slice(0,-e).join("/")),t}bender.test({setUp:function(){bender.tools.ignoreUnsupportedEnvironment("exportpdf"),this.paths={relative0:e(bender.testDir),relative1:e(bender.testDir,1),relative3:e(bender.testDir,3)}},"test absolute image urls are not changed":function(){t('<p>Foo <img src="https://ckeditor.com/img/image1.jpg" /><img src="https://ckeditor.com/img/image2.png" /></p>','<p>Foo <img src="https://ckeditor.com/img/image1.jpg" /><img src="https://ckeditor.com/img/image2.png" /></p>')},"test relative (to root) image urls are changed to absolute":function(){t('<p><img src="/img/image1.jpg" /> Bar <img src="/img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl("/img/image1.jpg")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl("/img/big/image2.png")+'" /></p>')},'test relative (to root) image urls with ".." are changed to absolute':function(){t('<p><img src="/../img/image1.jpg" /> Bar <img src="/../../img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl("/img/image1.jpg")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl("/img/big/image2.png")+'" /></p>')},"test relative (to root) image urls with custom baseHref are changed to absolute":function(){t('<p><img src="/img/image1.jpg" /> Bar <img src="/img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl("/img/image1.jpg","http://ckeditor.com")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl("/img/big/image2.png","http://ckeditor.com")+'" /></p>',{baseHref:"http://ckeditor.com/ckeditor4/"})},'test relative (to root) image urls with custom baseHref and ".." are changed to absolute':function(){t('<p><img src="/../img/image1.jpg" /> Bar <img src="/../../img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl("/img/image1.jpg","http://ckeditor.com")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl("/img/big/image2.png","http://ckeditor.com")+'" /></p>',{baseHref:"http://ckeditor.com/ckeditor4/"})},"test relative (to current url) image urls are changed to absolute":function(){t('<p><img src="img/image1.jpg" /> Bar <img src="img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl(this.paths.relative0+"/img/image1.jpg")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl(this.paths.relative0+"/img/big/image2.png")+'" /></p>')},'test relative (to current url) image urls with ".." are changed to absolute':function(){t('<p><img src="../img/image1.jpg" /> Bar <img src="../../../img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl(this.paths.relative1+"/img/image1.jpg")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl(this.paths.relative3+"/img/big/image2.png")+'" /></p>')},"test relative (to current url) image urls with custom baseHref are changed to absolute":function(){t('<p><img src="img/image1.jpg" /> Bar <img src="img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl("img/image1.jpg","http://ckeditor.com/ckeditor4/")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl("img/big/image2.png","http://ckeditor.com/ckeditor4/")+'" /></p>',{baseHref:"http://ckeditor.com/ckeditor4/"})},'test relative (to current url) image urls with custom baseHref and ".." are changed to absolute':function(){t('<p><img src="../img/image1.jpg" /> Bar <img src="../../img/big/image2.png" /></p>','<p><img src="'+exportPdfUtils.toAbsoluteUrl("img/image1.jpg","https://ckeditor.com/ckeditor4/")+'" /> Bar <img src="'+exportPdfUtils.toAbsoluteUrl("img/big/image2.png","https://ckeditor.com/")+'" /></p>',{baseHref:"https://ckeditor.com/ckeditor4/demo/"})}})}));